# Tanım: JavaScript yorumlayıcı ve kütüphaneleri - Sürüm 38
# URL: https://developer.mozilla.org/en-US/docs/Mozilla/Projects/SpiderMonkey/Releases/38
# Paketçi: milisarge
# Gerekler: nspr icu libffi python zip
# Grup: kütüphane

isim=js38
surum=38.8.0
devir=2
kaynak=(https://ftp.mozilla.org/pub/firefox/releases/38.8.0esr/source/firefox-38.8.0esr.source.tar.bz2
        mozjs38-fix-tracelogger.patch
        mozjs38-install-name.patch
        mozjs38-copy-headers.patch
        mozjs38-1269317.patch)

derle() {
  cd mozilla-esr38
  patch -Np1 -i $SRC/mozjs38-fix-tracelogger.patch
  patch -Np1 -i $SRC/mozjs38-install-name.patch
  patch -Np1 -i $SRC/mozjs38-copy-headers.patch
  patch -Np1 -i $SRC/mozjs38-1269317.patch
  unset CPPFLAGS
  CXXFLAGS+=' -fno-delete-null-pointer-checks -fpermissive -fno-tree-vrp -fno-strict-aliasing'
  CFLAGS+=' -fno-delete-null-pointer-checks -fpermissive -fno-tree-vrp -fno-strict-aliasing'
  export PYTHON=/usr/bin/python2
  export SHELL=/bin/sh
  
  cd $SRC/mozilla-esr38/js/src
  ./configure --prefix=/usr --with-system-nspr --enable-system-ffi \
    --with-system-zlib --with-system-icu --with-intl-api --enable-ctypes \
    --enable-threadsafe --enable-system-ffi --enable-shared-js --enable-gcgenerational --disable-optimize --enable-pie
 
  SHELL=/bin/sh make || SHELL=/bin/sh make
  SHELL=/bin/sh make DESTDIR="$PKG" install
  rm -f "$PKG"/usr/lib/*.ajs
  find "$PKG"/usr/{lib/pkgconfig,include} -type f -exec chmod -x {} +
  mv $PKG/usr/lib/pkgconfig/js.pc $PKG/usr/lib/pkgconfig/mozjs-38.pc
}
